<div class="venue-content">
    <h4>please select a venue</h4>  
    <div class="venue-wrapper">   
        <div id="venueCarousel" class="carousel slide"  data-ride="carousel" data-interval="40000"> 
            <div class="carousel-inner">
                <?php
                $i = 1;
                $j = 1;
//$venueId='';
                $classWithVenue = classes::getclassWithVenues($model->id);
                $count = count($classWithVenue);
                foreach ($classWithVenue as $venueValue) {
                    if (($i == 1)) {
                        $venueId = $venueValue->class_venue_id;
                    }

                    $active = ($i == 1) ? 'active' : '';
                    echo ($i == 1 || $j == 1) ? '<div class="item ' . $active . '">' : '';
                    ?>
                    <div class="venue-slide <?php echo ($j == 1) ? 'active' : ''; ?>" id="selected_venue_<?php echo $venueValue->class_venue_id; ?>">
                        <a  href="javascript:void(0);" data-toggle="tab"  onclick="showBatchDeatils(<?php echo $venueValue->class_venue_id; ?>,<?php echo $model->id; ?>);"><?php echo $venueValue->classVenue->name; ?>
                            <address id="venue-addr<?php echo $venueValue->class_venue_id ?>">                               
                                <?php echo $venueValue->classVenue->address_line1 . ', ' . $venueValue->classVenue->address_line2; ?>
                                <?php echo $venueValue->classVenue->city->city_name . ', ' . $venueValue->classVenue->city->city_name . '<br/> ' . $venueValue->classVenue->state->name; ?>
                                <?php echo $venueValue->classVenue->country->name . ', ' . $venueValue->classVenue->zip_code; ?>
                            </address>
                        </a>
                    </div>
                    <?php
                    if ($j == 3 || $count == $i) {
                        echo '</div>';
                        $j = 0;
                    }
                    $j++;
                    $i++;
                }
                ?>
                <!--item active-->
                <!--item-->
            </div><!--venue inner-->

        </div><!--venue carousel-->
        <?php if ($count > 3) { ?>
            <a class="carousel-control right my-right" href="#venueCarousel" data-slide="prev"><span class="glyphicon glyphicon-chevron-left review-control"></span></a>
            <a class="carousel-control right my-next" href="#venueCarousel" data-slide="next"><span class="glyphicon glyphicon-chevron-right review-control"></a>  
        <?php } ?>

    </div><!--venue wrapper-->
    <!-- Tab panes -->
    <div class="tab-contents" id="venueBatchDetails">
        <script>
                        $(document).ready(function() {
                            showBatchDeatils(<?php echo $venueId; ?>,<?php echo $model->id; ?>);
                        });</script>
    </div><!--venue inner tab end here-->              
</div><!--venue-content end here-->  



<script>
    function showBatchDeatils(venueId, classId) {
        $(".venue-slide").removeClass("active");
        $("#selected_venue_" + venueId).addClass("active");
        jQuery.ajax({
            'type': 'POST',
            'url': "<?php echo Yii::app()->createAbsoluteUrl("/ClassVenue/getBatchDetails"); ?>",
            'data': 'YII_CSRF_TOKEN=' + $('input[name="YII_CSRF_TOKEN"]').val() + "&venueId=" + venueId + '&classId=' + classId,
            'beforeSend': function(jqXHR, settings) {
                //imageloding();
            },
            'success': function(data) {
                $("#venueBatchDetails").html('');
                $("#venueBatchDetails").html(data);
                //$(document).ajaxStop($.unblockUI);
            },
            'cache': false
        });
    }</script>